package gui;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.wb.swt.SWTResourceManager;

import data.model.Project;
import data.model.ProjectCharacteristics;

public class ProjectComposite extends Composite {
	private final Project project;

	/**
	 * Create the composite.
	 * 
	 * @param parent
	 * @param style
	 */
	public ProjectComposite(Composite parent, int style, Project project,
			ProjectCharacteristics projectHealthCriteria) {
		super(parent, style);

		this.project = project;
		setLayout(new GridLayout(3, false));

		Label lblProjectName = new Label(this, SWT.NONE);
		lblProjectName.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false,
				false, 3, 1));
		lblProjectName.setFont(SWTResourceManager.getFont("Segoe UI", 12,
				SWT.BOLD));
		lblProjectName.setText(project.getId());

		Label lblProgress = new Label(this, SWT.NONE);
		lblProgress.setText("Progress");

		Composite progressComposite = new ProgressComposite(this, SWT.NONE,
				project.getProgressInPercent());
		progressComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false,
				false, 1, 1));

		Label lblWeek = new Label(this, SWT.NONE);
		lblWeek.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false,
				1, 1));
		lblWeek.setText("  Week " + project.getFirstWeekNumberWithoutData()
				+ " of " + project.getDurationInWeeks());

		Composite projectDataComposite = new ProjectDataComposite(this,
				SWT.NONE, project, projectHealthCriteria);
		projectDataComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP,
				false, true, 3, 1));

	}

}
